﻿<!--#include file="base.asp"-->
<%
''' SDCMS 会员
''' ==================================================================
''' 版权所有 http://www.sdcms.cn
''' ------------------------------------------------------------------
''' 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用；
''' 未经授权不允许对程序代码以任何形式任何目的的再发布。
''' ==================================================================
''' 编写: IT平民
''' 修改：IT平民 in 2014.07

	sub configdb()
		dim t0,t1,t2,t3,t4
		t0=sdcms.enhtml(sdcms.fpost("t0",0))
		t1=sdcms.enhtml(sdcms.fpost("t1",0))
		t2=sdcms.enhtml(sdcms.fpost("t2",0))
		t3=sdcms.enhtml(sdcms.fpost("t3",0))
		t4=sdcms.enhtml(sdcms.fpost("t4",0))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='isreg'",array(array("setvalue",t0,7,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='userclose'",array(array("setvalue",t1,0,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='ispass'",array(array("setvalue",t2,5,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='baduser'",array(array("setvalue",t3,0,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='agreement'",array(array("setvalue",t4,0,1))
		sdcms.delcache "sdcmsdata"
		sdcms.ajaxjson "保存成功",1
	end sub
	
	sub configactivedb()
		dim t0,t1
		t0=sdcms.enhtml(sdcms.fpost("t0",0))
		t1=sdcms.enhtml(sdcms.fpost("t1",0))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='regtitle'",array(array("setvalue",t0,255,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='regcontent'",array(array("setvalue",t1,0,1))
		sdcms.delcache "sdcmsdata"
		sdcms.ajaxjson "保存成功",1
	end sub
	
	sub configpassdb()
		dim t0,t1
		t0=sdcms.enhtml(sdcms.fpost("t0",0))
		t1=sdcms.enhtml(sdcms.fpost("t1",0))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='passtitle'",array(array("setvalue",t0,255,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='passcontent'",array(array("setvalue",t1,0,1))
		sdcms.delcache "sdcmsdata"
		sdcms.ajaxjson "保存成功",1
	end sub
	
	sub strategydb()
		dim t0,t1,t2,t3,t4,t5,t6,t7,t8
		t0=sdcms.getint(sdcms.fpost("t0",0),0)
		t1=sdcms.getint(sdcms.fpost("t1",0),0)
		t2=sdcms.getint(sdcms.fpost("t2",0),0)
		t3=sdcms.getint(sdcms.fpost("t3",0),0)
		t4=sdcms.getint(sdcms.fpost("t4",0),0)
		t5=sdcms.getint(sdcms.fpost("t5",0),100)
		t6=sdcms.getint(sdcms.fpost("t6",0),10)
		t7=sdcms.getint(sdcms.fpost("t7",0),120)
		t8=sdcms.getint(sdcms.fpost("t8",0),10)
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_reg'",array(array("setvalue",t0,10,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_login'",array(array("setvalue",t1,10,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_publish'",array(array("setvalue",t2,10,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_active'",array(array("setvalue",t3,10,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_invite'",array(array("setvalue",t4,10,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_exchange'",array(array("setvalue",t5,10,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_monthprice'",array(array("setvalue",t6,5,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_yearprice'",array(array("setvalue",t7,10,1))
		sdcms.db.dbupdate "sd_config","setname='sdcms.strategy' and setkey='str_gift'",array(array("setvalue",t8,10,1))
		sdcms.delcache "sdcmsdata"
		sdcms.ajaxjson "保存成功",1
	end sub
	
	sub groupadddb()
		dim t0,t1,t2,t3,t4,t5,t6,t7,t8,t9
		t0=sdcms.enhtml(sdcms.fpost("t0",0))
		t1=sdcms.getint(sdcms.fpost("t1",0),100)
		t2=sdcms.getint(sdcms.fpost("t2",0),0)
		t3=sdcms.getint(sdcms.fpost("t3",0),0)
		t4=sdcms.getint(sdcms.fpost("t4",0),0)
		t5=sdcms.getint(sdcms.fpost("t5",0),0)
		t6=sdcms.getint(sdcms.fpost("t6",0),0)
		t7=sdcms.getint(sdcms.fpost("t7",0),0)
		t8=sdcms.getint(sdcms.fpost("t8",0),0)
		t9=sdcms.getint(sdcms.fpost("t9",0),0)
		if sdcms.strlen(t0)=0 then sdcms.ajaxjson "&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if t1>100 then t1=100
		if t1<=0 then t1=1
		if t8>1000 then t8=0
		dim data
		data=array(array("groupname",t0,50,1),array("rate",t1,3,0),array("point",t2,10,0),array("allowupgrade",t3,1,0),array("allowlogin",t4,1,0),array("allowpost",t5,1,0),array("allowpostverify",t6,1,0),array("allowattachment",t7,1,0),array("allowpostnum",t8,4,0),array("isdefault",t9,1,0))
		if sdcms.db.dbnew("sd_user_group",data,"groupname='"&t0&"'")=0 then
			sdcms.ajaxjson "&#21517;&#31216;&#24050;&#23384;&#22312;&#65292;&#35831;&#25442;&#20010;&#35797;&#35797;",0:exit sub
		else
			if t9=1 then
				sdcms.db.dbupdate "sd_user_group","groupname<>'"&t0&"'",array(array("isdefault",0,1,0))
			end if
			updategroup
			sdcms.ajaxjson "保存成功",1
		end if
	end sub
	
	sub groupeditdb()
		dim id:id=sdcms.getint(sdcms.fget("id",0),0)
		if id>0 then
			dim t0,t1,t2,t3,t4,t5,t6,t7,t8,t9
			t0=sdcms.enhtml(sdcms.fpost("t0",0))
			t1=sdcms.getint(sdcms.fpost("t1",0),100)
			t2=sdcms.getint(sdcms.fpost("t2",0),0)
			t3=sdcms.getint(sdcms.fpost("t3",0),0)
			t4=sdcms.getint(sdcms.fpost("t4",0),0)
			t5=sdcms.getint(sdcms.fpost("t5",0),0)
			t6=sdcms.getint(sdcms.fpost("t6",0),0)
			t7=sdcms.getint(sdcms.fpost("t7",0),0)
			t8=sdcms.getint(sdcms.fpost("t8",0),0)
			t9=sdcms.getint(sdcms.fpost("t9",0),0)
		
			if sdcms.strlen(t0)=0 then sdcms.ajaxjson "&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
			if t1>100 then t1=100
			if t1<=0 then t1=1
			if t8>1000 then t8=0
	
			if sdcms.db.dbcount("sd_user_group","id<>"&id&" and groupname='"&t0&"'")>0 then
				sdcms.ajaxjson "&#21517;&#31216;&#24050;&#23384;&#22312;&#65292;&#35831;&#25442;&#20010;&#35797;&#35797;",0:exit sub
			else
				dim data
				data=array(array("groupname",t0,50,1),array("rate",t1,3,0),array("point",t2,10,0),array("allowupgrade",t3,1,0),array("allowlogin",t4,1,0),array("allowpost",t5,1,0),array("allowpostverify",t6,1,0),array("allowattachment",t7,1,0),array("allowpostnum",t8,4,0),array("isdefault",t9,1,0))
				sdcms.db.dbupdate "sd_user_group","id="&id&"",data
				if t9=1 then
					sdcms.db.dbupdate "sd_user_group","groupname<>'"&t0&"'",array(array("isdefault",0,1,0))
				end if
				updategroup
				sdcms.ajaxjson "保存成功",1
			end if
		end if
	end sub
	
	sub groupdel()
		dim id:id=sdcms.getint(sdcms.fget("id",0),0)
		if id>0 then
			sdcms.db.dbupdate "sd_user","groupid="&id&"",array(array("groupid",0,1,0))
			sdcms.db.dbdel "sd_user_group","id="&id&""
		end if
		updategroup
		sdcms.echo "1"
	end sub
	
	sub adddb()
		dim t0,t1,t2,t3,t4,t5,t6,t7,t8
		t0=sdcms.enhtml(sdcms.fpost("t0",0))
		t1=sdcms.enhtml(sdcms.fpost("t1",0))
		t2=sdcms.enhtml(sdcms.fpost("t2",0))
		t3=sdcms.getint(sdcms.fpost("t3",0),0)
		t4=sdcms.enhtml(sdcms.fpost("t4",0))
		t5=sdcms.getint(sdcms.fpost("t5",0),0)
		t6=sdcms.enhtml(sdcms.fpost("t6",0))
		t7=sdcms.enhtml(sdcms.fpost("t7",0))
		t8=sdcms.enhtml(sdcms.fpost("t8",0))
		select case t4
			case "0","1":t4=clng(t4)
			case else:t4=-1
		end select
		
		if sdcms.strlen(t0)=0 then sdcms.ajaxjson "&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if sdcms.strlen(t1)=0 then sdcms.ajaxjson "&#23494;&#30721;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if sdcms.strlen(t2)=0 then sdcms.ajaxjson "&#37038;&#31665;&#19981;&#33021;&#20026;&#31354;",0:exit sub
	
		if not(sdcms.checkstr(t0,"username")) then
			sdcms.ajaxjson "&#29992;&#25143;&#21517;&#38271;&#24230;&#24517;&#39035;&#20026;&#65306;&#53;&#45;&#50;&#48;&#20010;&#23383;&#31526;",0
			exit sub
		end if
		if not(sdcms.checkstr(t1,"password")) then
			sdcms.ajaxjson "&#23494;&#30721;&#38271;&#24230;&#24517;&#39035;&#20026;&#65306;&#54;&#45;&#49;&#54;&#20010;&#23383;&#31526;",0
			exit sub
		end if
		if not(sdcms.checkstr(t2,"email")) then sdcms.ajaxjson "&#37038;&#31665;&#26684;&#24335;&#38169;&#35823;",0:exit sub
		if t5=1 then
			if sdcms.strlen(t6)=0 then sdcms.ajaxjson "&#21040;&#26399;&#26102;&#38388;&#19981;&#33021;&#20026;&#31354;",0:exit sub
			t6=sdcms.getdate(t6,"",1)
		else
			t6=0
		end if
		dim data
		data=array(array("username",t0,20),array("password",md5(t1),50),array("nickname",t8,10),array("email",t2,50),array("groupid",t3,0),array("islock",t4,2),array("isvip",t5,1),array("overdate",t6,8),array("remark",t7,255),array("createip",sdcms.getip,50),array("logintimes",0,1),array("createdate",now(),0),array("percent",23,0),array("amount",0,2),array("point",0,2),array("avatar",0,0))
		if sdcms.db.dbnew("sd_user",data,"username='"&t0&"'")=0 then
			sdcms.ajaxjson "&#29992;&#25143;&#21517;&#24050;&#23384;&#22312;&#65292;&#35831;&#25442;&#20010;&#35797;&#35797;",0:exit sub
		else
			sdcms.ajaxjson "保存成功",1
		end if
	end sub
	
	sub editdb()
		dim id:id=sdcms.getint(sdcms.fget("id",0),0)
		dim t0,t0_1,t1,t2,t3,t4,t5,t6,t7,t8
		t0=sdcms.enhtml(sdcms.fpost("t0",0))
		t0_1=sdcms.enhtml(sdcms.fpost("t0_1",0))
		t1=sdcms.enhtml(sdcms.fpost("t1",0))
		t2=sdcms.enhtml(sdcms.fpost("t2",0))
		t3=sdcms.getint(sdcms.fpost("t3",0),0)
		t4=sdcms.enhtml(sdcms.fpost("t4",0))
		t5=sdcms.getint(sdcms.fpost("t5",0),0)
		t6=sdcms.enhtml(sdcms.fpost("t6",0))
		t7=sdcms.enhtml(sdcms.fpost("t7",0))
		t8=sdcms.enhtml(sdcms.fpost("t8",0))
		select case t4
			case "0","1":t4=clng(t4)
			case else:t4=-1
		end select
		if sdcms.strlen(t0)=0 then sdcms.ajaxjson "&#21517;&#31216;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		if sdcms.strlen(t2)=0 then sdcms.ajaxjson "&#37038;&#31665;&#19981;&#33021;&#20026;&#31354;",0:exit sub
		
		if not(sdcms.checkstr(t0,"username")) then
			sdcms.ajaxjson "&#29992;&#25143;&#21517;&#38271;&#24230;&#24517;&#39035;&#20026;&#65306;&#53;&#45;&#50;&#48;&#20010;&#23383;&#31526;",0
			exit sub
		end if
		if sdcms.strlen(t1)>0 then
			if not(sdcms.checkstr(t1,"password")) then
				sdcms.ajaxjson "&#23494;&#30721;&#38271;&#24230;&#24517;&#39035;&#20026;&#65306;&#54;&#45;&#49;&#54;&#20010;&#23383;&#31526;",0
				exit sub
			end if
		end if
		if not(sdcms.checkstr(t2,"email")) then sdcms.ajaxjson "&#37038;&#31665;&#26684;&#24335;&#38169;&#35823;",0:exit sub
		if t5=1 then
			if sdcms.strlen(t6)=0 then sdcms.ajaxjson "&#21040;&#26399;&#26102;&#38388;&#19981;&#33021;&#20026;&#31354;",0:exit sub
			t6=sdcms.getdate(t6,"",1)
		else
			t6=0
		end if
		
		dim data
		if t0=t0_1 then
			if sdcms.strlen(t1)=0 then
				data=array(array("nickname",t8,10,1),array("email",t2,50,1),array("groupid",t3,0,0),array("islock",t4,0,0),array("isvip",t5,0,0),array("overdate",t6,0,0),array("remark",t7,255,1))
			else
				data=array(array("password",md5(t1),50,1),array("nickname",t8,10,1),array("email",t2,50,1),array("groupid",t3,0,0),array("islock",t4,0,0),array("isvip",t5,0,0),array("overdate",t6,0,0),array("remark",t7,255,1))
			end if
		else
			if sdcms.db.dbcount("sd_user","id<>"&id&" and username='"&t0&"'")>0 then
				sdcms.ajaxjson "&#29992;&#25143;&#21517;&#24050;&#23384;&#22312;&#65292;&#35831;&#25442;&#20010;&#35797;&#35797;",0:exit sub
			else
				if sdcms.strlen(t1)=0 then
					data=array(array("username",t0,20,1),array("nickname",t8,10,1),array("email",t2,50,1),array("groupid",t3,0,0),array("islock",t4,0,0),array("isvip",t5,0,0),array("overdate",t6,0,0),array("remark",t7,255,1))
				else
					data=array(array("username",t0,20,1),array("nickname",t8,10,1),array("password",md5(t1),50,1),array("email",t2,50,1),array("groupid",t3,0,0),array("islock",t4,0,0),array("isvip",t5,0,0),array("overdate",t6,0,0),array("remark",t7,255,1))
				end if
			end if
		end if
		sdcms.db.dbupdate "sd_user","id="&id&"",data
		sdcms.ajaxjson "保存成功",1
	end sub
	
	sub basedb()
		dim id:id=sdcms.getint(sdcms.fget("id",0),0)
		dim t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,data
		t0=sdcms.enhtml(sdcms.fpost("u0",0))
		t1=sdcms.enhtml(sdcms.fpost("u1",0))
		t2=sdcms.enhtml(sdcms.fpost("u2",0))
		t3=sdcms.enhtml(sdcms.fpost("u3",0))
		t4=sdcms.enhtml(sdcms.fpost("u4",0))
		t5=sdcms.enhtml(sdcms.fpost("u5",0))
		t6=sdcms.enhtml(sdcms.fpost("u6",0))
		t7=sdcms.enhtml(sdcms.fpost("u7",0))
		t8=sdcms.enhtml(sdcms.fpost("u8",0))
		t9=sdcms.enhtml(sdcms.fpost("u9",0))
		dim percent:percent=3
		data="array("
	
		if sdcms.strlen(t0)>0 then
			if not(sdcms.checkstr(t0,"cn")) then
				sdcms.ajaxjson "姓名由2-4位汉字组成",0
				exit sub
			end if
			percent=percent+1
			data=data&"array(""truename"",t0,6,1),"
		else
			data=data&"array(""truename"","""",0,1),"
		end if
		select case t1
			case "1","2"
			percent=percent+1
			data=data&"array(""sex"",t1,1,1),"
			case else
			data=data&"array(""sex"","""",0,1),"
		end select
	
		if sdcms.strlen(t2)>0 then
			if not isdate(t2) then
				sdcms.ajaxjson "生日格式错误",0
				exit sub
			end if
			t2=sdcms.getdate(t2,"-",1)
			percent=percent+1
			data=data&"array(""birthday"",t2,12,1),"
		else
			t2="1753-01-01"
			data=data&"array(""birthday"",t2,12,1),"
		end if
		if sdcms.strlen(t3)>0 then
			if not(sdcms.checkstr(t3,"qq")) then
				sdcms.ajaxjson "请正确输入QQ",0
				exit sub
			end if
			percent=percent+1
			data=data&"array(""qq"",t3,17,1),"
		else
			data=data&"array(""qq"","""",0,1),"
		end if
		if sdcms.strlen(t4)>0 then
			if not(sdcms.checkstr(t4,"email")) then
				sdcms.ajaxjson "请正确输入MSN",0
				exit sub
			end if
			percent=percent+1
			data=data&"array(""msn"",t4,50,1),"
		else
			data=data&"array(""msn"","""",0,1),"
		end if
		if sdcms.strlen(t5)>0 then
			if not(sdcms.checkstr(t5,"mobile")) then
				sdcms.ajaxjson "请正确输入手机号",0
				exit sub
			end if
			percent=percent+1
			data=data&"array(""mobile"",t5,11,1),"
		else
			data=data&"array(""mobile"","""",0,1),"
		end if
		if sdcms.strlen(t6)>0 then
			if not(sdcms.checkstr(t6,"tel")) then
				sdcms.ajaxjson "请正确输入电话号码",0
				exit sub
			end if
			percent=percent+1
			data=data&"array(""tel"",t6,13,1),"
		else
			data=data&"array(""tel"","""",0,1),"
		end if
		if sdcms.strlen(t7)>0 then
			percent=percent+1
			data=data&"array(""job"",t7,12,1),"
		else
			data=data&"array(""job"","""",0,1),"
		end if
		if sdcms.strlen(t8)>0 then
			if not(sdcms.checkstr(t8,"zipcode")) then
				sdcms.ajaxjson "请正确输入邮编",0
				exit sub
			end if
			percent=percent+1
			data=data&"array(""zipcode"",t8,8,1),"
		else
			data=data&"array(""zipcode"","""",0,1),"
		end if
		if sdcms.strlen(t9)>0 then
			percent=percent+1
			data=data&"array(""address"",t9,255,1),"
		else
			data=data&"array(""address"","""",0,1),"
		end if
		percent=clng((percent/13)*100)
		if right(data,1)="," then
			data=left(data,len(data)-1)
		end if
		data=data&")"
		sdcms.db.dbupdate "sd_user_data","userid="&id&"",eval(data)
		sdcms.db.dbupdate "sd_user","id="&id&"",array(array("percent",percent,3,0))
		sdcms.ajaxjson "保存成功",1
	end sub
	
	sub del()
		dim id:id=sdcms.getint(sdcms.fget("id",0),0)
		if id>0 then
			sdcms.db.dbdel "sd_user_payrecord","userid="&id&""
			sdcms.db.dbdel "sd_user_bind","userid="&id&""
			sdcms.db.dbdel "sd_user_data","userid="&id&""
			sdcms.db.dbdel "sd_user_favorite","userid="&id&""
			sdcms.db.dbdel "sd_user_message","userid="&id&""
			sdcms.db.dbdel "sd_user_money","userid="&id&""
			sdcms.db.dbdel "sd_user_point","userid="&id&""
			sdcms.db.dbdel "sd_user_buy","userid="&id&""
			sdcms.db.dbupdate "sd_expand_comment","userid="&id&"",array(array("userid",0,0,0),array("avatar",0,0,0))
			sdcms.db.dbupdate "sd_expand_book","userid="&id&"",array(array("userid",0,0,0),array("avatar",0,0,0))
			delpublish id
			sdcms.delfolder webroot&"upfile/avatar/"&id
			sdcms.db.dbdel "sd_user","id="&id&""
		end if
		sdcms.echo "1"
	end sub
	
	sub delpublish(byval t0)
		dim arr,j
		arr=sdcms.db.dbload("","id,(select tablename from view_category where cateid=sd_content.classid) as tablename","sd_content","userid="&t0&" and islock<0","")
		if ubound(arr)>=0 then
			for j=0 to ubound(arr,2)
				sdcms.db.dbdel arr(1,j),"cid="&arr(0,j)&""
				sdcms.db.dbdel "sd_content","id="&arr(0,j)&""
			next
		end if
		sdcms.db.dbupdate "sd_attachment","userid="&t0&" and cid<=0",array(array("cid",-1,0,0))
	end sub
	
	sub delall()
		dim id:id=sdcms.enhtml(sdcms.fget("id",0))
		dim idarr:idarr=split(id,",")
		if ubound(idarr)<0 then
			sdcms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					sdcms.echo "0&#21442;&#25968;&#65306;"&id(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				end if
			next
			for i=0 to ubound(idarr)
				sdcms.db.dbdel "sd_user_payrecord","userid="&idarr(i)&""
				sdcms.db.dbdel "sd_user_bind","userid="&idarr(i)&""
				sdcms.db.dbdel "sd_user_data","userid="&idarr(i)&""
				sdcms.db.dbdel "sd_user_favorite","userid="&idarr(i)&""
				sdcms.db.dbdel "sd_user_message","userid="&idarr(i)&""
				sdcms.db.dbdel "sd_user_money","userid="&idarr(i)&""
				sdcms.db.dbdel "sd_user_point","userid="&idarr(i)&""
				sdcms.db.dbdel "sd_user_buy","userid="&idarr(i)&""
				sdcms.db.dbupdate "sd_expand_comment","userid="&idarr(i)&"",array(array("userid",0,0,0),array("avatar",0,0,0))
				sdcms.db.dbupdate "sd_expand_book","userid="&idarr(i)&"",array(array("userid",0,0,0),array("avatar",0,0,0))
				delpublish idarr(i)
				sdcms.delfolder webroot&"upfile/avatar/"&idarr(i)
				sdcms.db.dbdel "sd_user","id="&idarr(i)&""
			next
			sdcms.echo "1"
		end if
	end sub
	
	sub doset()
		dim id:id=sdcms.enhtml(sdcms.fget("id",0))
		dim go:go=sdcms.enhtml(sdcms.fget("go",0))
		dim idarr:idarr=split(id,",")
		if ubound(idarr)<0 then
			sdcms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					sdcms.echo "0&#21442;&#25968;&#65306;"&id(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				end if
			next
			dim filed,result
			select case go
				case "islock":filed="islock":result=1
				case "nolock":filed="islock":result=-1
				case else:sdcms.echo "0&#21442;&#25968;&#38169;&#35823;":exit sub
			end select
			sdcms.db.dbupdate "sd_user","id in("&id&")",array(array(filed,result,2,0))
			sdcms.echo "1"
		end if
	end sub
	
	sub movedb()
		dim id:id=sdcms.enhtml(sdcms.fget("id",0))
		dim go:go=sdcms.enhtml(sdcms.fget("go",0))
		dim idarr:idarr=split(id,",")
		if ubound(idarr)<0 then
			sdcms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					sdcms.echo "0&#21442;&#25968;&#65306;"&id(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				end if
			next
			sdcms.db.dbupdate "sd_user","id in("&id&")",array(array("groupid",go,0,0))
			sdcms.echo "1"
		end if
	end sub
	
	sub movecate()
		dim comecate:comecate=sdcms.getint(sdcms.fget("comecate",0),0)
		dim gocate:gocate=sdcms.getint(sdcms.fget("gocate",0),0)
		sdcms.db.dbupdate "sd_user","groupid="&comecate&"",array(array("groupid",gocate,0,0))
		sdcms.echo "1"
	end sub
	
	sub updategroup()
		dim data,groupid
		data=sdcms.db.dbload(1,"id","sd_user_group","isdefault=1","")
		if ubound(data)<0 then
			groupid=0
		else
			groupid=data(0,0)
		end if
		sdcms.db.dbupdate "sd_config","setname='sdcms.user' and setkey='groupid'",array(array("setvalue",groupid,0,1))
		sdcms.delcache "sdcmsdata"
	end sub

	islogin
	dim act:act=lcase(sdcms.fget("act",0))
	dim sta,nat,order,keyword
	sta=sdcms.getint(sdcms.fget("sta",0),0)
	nat=sdcms.getint(sdcms.fget("nat",0),0)
	order=sdcms.getint(sdcms.fget("order",0),0)
	keyword=sdcms.enhtml(sdcms.fget("keyword",1))
	select case act
		case "config","config_active","config_pass"
			checkpagelever 22
			dim userdata,maildata
			userdata=sdcms.db.dbload("","setvalue","sd_config","setname='sdcms.user'","")
			maildata=sdcms.db.dbload(1,"setvalue","sd_config","setname='sdcms.mail' and setkey='mailtype'","")
			load eval("theme_user"&act)
		case "strategy"
			checkpagelever 26
			userdata=sdcms.db.dbload("","setvalue","sd_config","setname='sdcms.strategy'","")
			load eval("theme_userstrategy")
		case "strategydb":checkpagelever 26:strategydb
		case "configdb":checkpagelever 22:configdb
		case "configactivedb":checkpagelever 22:configactivedb
		case "configpassdb":checkpagelever 22:configpassdb
		case "group","groupadd","groupedit":
			checkpagelever 23
			dim id:id=sdcms.getint(sdcms.fget("id",0),0)
			load eval("theme_user"&act)
		case "groupadddb":checkpagelever 23:groupadddb
		case "groupeditdb":checkpagelever 23:groupeditdb
		case "groupdel":checkpagelever 23:groupdel
		case "list"
			checkpagelever 24
			dim sqlwhere,statitle,nattitle,orderby,ordtitle,wherekey,thisdate
			thisdate=clng(year(now())&right("0"&month(now()),2)&right("0"&day(now()),2))
			select case sta
				case "1":sqlwhere=" and islock=1":statitle="状态:正常"
				case "2":sqlwhere=" and islock=0":statitle="状态:未激活"
				case "3":sqlwhere=" and islock=-1":statitle="状态:锁定"
				case else:statitle="按状态↓"
			end select
			select case nat
				case "1":sqlwhere=" and logintimes=0":nattitle="性质:未登录过"
				case "2":sqlwhere=" and isvip=1 and overdate>="&thisdate&"":nattitle="性质:VIP会员(正常)"
				case "3":sqlwhere=" and isvip=1 and overdate<"&thisdate&"":nattitle="性质:VIP会员(过期)"
				case "4":sqlwhere=" and isvip=0":nattitle="性质:普通会员"
				case else:nattitle="按性质↓"
			end select
			select case order
				case "1":orderby="logintimes desc,id desc":ordtitle="状态:登录次数↑"
				case "2":orderby="logintimes,id":ordtitle="状态:登录次数↓"
				case "3":orderby="createdate desc,id desc":ordtitle="状态:注册日期↑"
				case "4":orderby="createdate,id":ordtitle="状态:注册日期↓"
				case "5":orderby="amount desc,id desc":ordtitle="状态:账户金额↑"
				case "6":orderby="amount,id":ordtitle="状态:账户金额↓"
				case "7":orderby="point desc,id desc":ordtitle="状态:账户积分↑"
				case "8":orderby="point,id":ordtitle="状态:账户积分↓"
				case else:orderby="id desc":ordtitle="按排序↓"
			end select
			if sdcms.strlen(keyword)>0 then
				if datatype then
					wherekey=" and instr(lcase(username),lcase('"&keyword&"'))>0 "
				else
					wherekey=" and username like '%"&keyword&"%'"
				end if
			end if
		dim get_group,k
		get_group="<option value=""0"">不属于任何组</option>"
		userdata=sdcms.db.dbload("","id,groupname","sd_user_group","","")
		if ubound(userdata)>=0 then
			for k=0 to ubound(userdata,2)
				get_group=get_group&"<option value="""&userdata(0,k)&""">"&userdata(1,k)&"</option>"
			next
		end if
		load eval("theme_user"&act)
		case "add":checkpagelever 24:load eval("theme_user"&act)
		case "adddb":checkpagelever 24:adddb
		case "edit","base":checkpagelever 24:id=sdcms.getint(sdcms.fget("id",0),0):load eval("theme_user"&act)
		case "editdb":checkpagelever 24:editdb
		case "basedb":checkpagelever 24:basedb
		case "del":checkpagelever 24:del
		case "delall":checkpagelever 24:delall
		case "doset":checkpagelever 24:doset
		case "move":checkpagelever 24:movedb
		case "movecate":checkpagelever 24:movecate
	end select
	
	sdcms.db.dbclose
%>